var g = '../img/detail/sc.png'
Page({
  data: {
    cc:{},
    ppzy:'../img/car/ppzy.png',
    xj:'../img/detail/xj.png',
    sc:'../img/detail/sc.png',
    car:'../img/detail/car.png'
  },
  car(e){
    console.log("car")
    wx.switchTab({
      url: '../car/car'
    })
  },
  joinCar(e){
    wx.showToast({
      title: '成功加入购物车',
    })
  },
  buy(e){
    wx.navigateTo({
      url: '../myd/myd'
    })
  },
  changeSc(e) {
    if (g == '../img/detail/sc.png'){
      g = '../img/detail/sc1.png';
      wx.showToast({
        title: '已收藏',
        icon:'none'
      })
    }
    else{
      g = '../img/detail/sc.png';
      wx.showToast({
        title: '取消收藏',
        icon: 'none'
      })
    }
   
    this.setData({ sc: g })
  },
  onLoad: function (options) {
    var pro = [{
      pic: ['../img/product/1.png', '../img/product/2.png','../img/product/3.png' ],
      dec: '三的 SD-JR02绞肉机家用电动小型搅馅切菜打碎肉机蒜泥蒜蓉搅拌机',
      price: 69,
      yprice: 169
    }, {
        pic: ['../img/product/2.png', '../img/product/1.png', '../img/product/3.png'],
      dec: '三的 SD-JR09绞肉机家用电动碎肉机不锈钢搅拌机小型搅馅打蒜蓉',
      price: 99,
      yprice: 199
    }, {
        pic: ['../img/product/3.png', '../img/product/2.png', '../img/product/4.png'],
      dec: '三的 SD-JR10家用绞肉机全自动大容量商用碎肉机碎菜搅馅切丝切片',
      price: 299,
      yprice: 399
    }, {
      pic: ['../img/product/4.png', '../img/product/2.png', '../img/product/1.png'],
      dec: '三的 SD-JR303绞肉机家用电动小型搅馅切菜打碎肉机蒜泥蒜蓉搅拌机',
      price: 119,
      yprice: 98
    }, {
      pic: ['../img/index/p1.png', '../img/index/p2.png', '../img/index/p4.png'],  
      dec: '三的 SD-JR10家用绞肉机全自动大容量商用碎肉机碎菜搅馅切丝切片',
      price: 239,
      yprice: 339
    }, {
       pic: ['../img/index/p2.png', '../img/index/p1.png', '../img/index/p3.png'],    
      dec: '三的 SD-JR303绞肉机家用电动小型搅馅切菜打碎肉机蒜泥蒜蓉搅拌机',
      price: 1999,
      yprice: 598
    }, {
        pic: ['../img/index/p3.png', '../img/index/p2.png', '../img/index/p1.png'],
      dec: '三的 SD-JR303绞肉机家用电动小型搅馅切菜打碎肉机蒜泥蒜蓉搅拌机',
      price: 284,
      yprice: 98
    }, {
      pic: ['../img/index/p4.png', '../img/index/p2.png', '../img/index/p1.png'],
      dec: '三的 SD-JR10家用绞肉机全自动大容量商用碎肉机碎菜搅馅切丝切片',
      price: 865,
      yprice: 345
    },{
        pic: ['../img/myD/1.png', '../img/myD/2.png', '../img/myD/1.png'],
      dec: '【品牌直采】三的 SD-JR02绞肉机家用电动小型',
      price: 149,
      yprice: 298,
    }, {
        pic: ['../img/myD/2.png', '../img/myD/1.png', '../img/myD/2.png'],
      dec: '【品牌直采】三的 SD-JR02绞肉机家用电动小型',
      price: 149,
      yprice: 298,
    }]
    var pages = getCurrentPages()
    var currentPage = pages[pages.length-1]
    var options = currentPage.options
    var current = options.id
    this.setData({
      cc: {
        pic:pro[current].pic,
        dec: pro[current].dec,
        price: pro[current].price,
        yprice: pro[current].yprice
      }
    })
  }
  
})